const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
// 配置静态文件服务中间件
// server地址
const app = express();
const port = 4001;

app.use(cookieParser('sign'));

// app.use(function (req, res, next) {
//   res.setHeader('Access-Control-Allow-Origin', `*`);
//   next();
// });

app.get('/api', function(req, res){
  console.log(req.signedCookies);   /*获取加密的cookie信息*/
  res.cookie('jw', 'test', {maxAge:600000,signed:true});
  res.send('abc');
})

app.use(express.static(`D:\\wk\\gitee\\webpack-demo\\src\\svg`));
app.use('/test', express.static(`D:\\wk\\gitee\\webpack-demo\\dist`));
app.use('/test2', express.static(`D:\\wk\\gitee\\vue-test\\dist`));
app.use('/test3', express.static(`C:\\Documents\\wk\\gitee\\test\\tmp`));

app.listen(port, function () {
  console.info(`server started in http://localhost:${port}`);
});
